/**
 * VulnerabilityInstall.js
 *
 * @description :: A model definition represents a database table/collection.
 * @docs        :: https://sailsjs.com/docs/concepts/models-and-orm/models
 */

module.exports = {

  attributes: {

    //  ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦  ╦╔═╗╔═╗
    //  ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
    //  ╩  ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
    installedAt: {
      example: 1670152500000,
      description: 'JS timestamp representing when this installation began on the host.',
      extendedDescription: 'This JS timestamp represents when the vulnerabiltiy dashboard first saw this vulnerable software on a host',
      type: 'number',
      isInteger: true,
      required: true,
    },

    uninstalledAt: {
      example: 1670152500000,
      description: 'JS timestamp representing when this installation ended on the host (i.e. the vuln was patched).',
      extendedDescription: 'If not resolved, then this is `0`.  (Which is ok, since 1970 is too long ago to be a relevant value.)',
      type: 'number',
      isInteger: true,
      defaultsTo: 0,
    },

    versionName: {
      type: 'string',
      description: 'The version of the vulnerable softare that was installed.',
    },

    softwareName: {
      type: 'string',
      description: 'The name of the vulnerable software that was installed.',
    },

    fleetApid: {
      type: 'number',
      description: 'The Fleet API ID of the vulnerable software that was installed.',
      required: true,
    },

    resolvedInVersion: {
      type: 'string',
      description: 'The name of the version of this software that is no longer vulnerable.',
      extendedDescription: 'This is the resolved_in_version value from the Fleet API.'
    },

    //  ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
    //  ║╣ ║║║╠╩╗║╣  ║║╚═╗
    //  ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝


    //  ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
    //  ╠═╣╚═╗╚═╗║ ║║  ║╠═╣ ║ ║║ ║║║║╚═╗
    //  ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
    vulnerability: {
      model: 'Vulnerability',
      required: true
    },

    host: {
      model: 'Host',
      required: true,
    },

  },

};

